package com.hainiu.cat.interview.juc;

import java.util.Hashtable;
import java.util.concurrent.locks.AbstractQueuedSynchronizer;
import java.util.concurrent.locks.ReentrantLock;
import java.util.concurrent.locks.ReentrantReadWriteLock;

/**
 * create by biji.zhao on 2021/7/6
 */
public class AQSTest extends AbstractQueuedSynchronizer{

    @Override
    protected boolean tryAcquire(int arg) {
        return super.tryAcquire(arg);
    }

    @Override
    protected boolean tryRelease(int arg) {
        return super.tryRelease(arg);
    }

    @Override
    protected int tryAcquireShared(int arg) {
        return super.tryAcquireShared(arg);
    }

    @Override
    protected boolean tryReleaseShared(int arg) {
        return super.tryReleaseShared(arg);
    }

    @Override
    protected boolean isHeldExclusively() {
        return super.isHeldExclusively();
    }

    public static void main(String[] args) {
        AbstractQueuedSynchronizer aqs = new AQSTest();

        ReentrantLock reentrantLock = new ReentrantLock();

        ReentrantReadWriteLock readWriteLock = new ReentrantReadWriteLock();
        readWriteLock.getQueueLength();

        Hashtable<Integer, Integer> a = new Hashtable<>();

        Thread thread = new Thread();
        thread.yield();
    }
}
